﻿using MengLin.OOP.DesignPattern.State.RoomManagerSys.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.State.OrderManager.Entity
{
    /// <summary>
    /// 订单
    /// 也叫环境类(状态的使用者)
    /// </summary>
    public class Order
    {
        public AbstractOrderState OrderState { get; set; }

        /// <summary>
        /// 得到订单的状态
        /// </summary>
        /// <returns></returns>
        public string GetState()
        {
            return OrderState.GetState();
        }

        /// <summary>
        /// 设置订单的状态
        /// </summary>
        /// <returns></returns>
        public void SetState(AbstractOrderState orderState)
        {
            OrderState = orderState;
        }

        /// <summary>
        /// 发货
        /// </summary>
        /// <returns></returns>
        public void SendGoods()
        {
            OrderState.SendGoods(this);
        }

        /// <summary>
        /// 付款
        /// </summary>
        /// <param name="room"></param>
        public void Payment()
        {
            OrderState.Payment(this);
        }

        /// <summary>
        /// 收货
        /// </summary>
        /// <param name="room"></param>
        public void ReceiveGoods()
        {
            OrderState.ReceiveGoods(this);
        }
    }
}
